package com.mezz.bones.framework.base.domain.response;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @author mezz
 * @date 2022-10-08 15:20
 * @description:
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageInfo<T> implements Serializable {

  private static final long serialVersionUID = 4627515164385331418L;
  /*当前页*/
  private Integer current;

  private Integer pageSize;

  /*总页数*/
  private Integer totalPage;

  /*总条数*/
  private Integer count;

  /*数据*/
  private List<T> list;

  public static PageInfo of(Integer page, Integer pageSize){

    PageInfo pageInfo = new PageInfo();
    pageInfo.setCurrent(page);
    pageInfo.setPageSize(pageSize);
    return pageInfo;
  }
}
